#ifndef _Button_H_
#define _Button_H_

#include <d3dx9.h>

struct UIVERTEX
{
	D3DXVECTOR4 Pos;
	DWORD		Color;
	D3DXVECTOR2 UV;
};

class Button
{
public:

	Button();
	~Button();

	bool AddButton( int id, int left, int top, int right, int bottom );
	bool Create( IDirect3DDevice9 *pkDevice, IDirect3DTexture9 *pkTexture );
	void Update( unsigned int dt );
	void Render();
	void Release();

	void OnLButton( bool Down );
	void OnMouseMove( int MouseX, int MouseY );

	void ChangeUV( bool Change );

	bool GetLButton() { return m_bLButton; }  
	bool GetEnable() { return m_bEnable; }
	int GetID() { return m_iID;  }

protected:

	IDirect3DDevice9		*m_pkDevice;
	IDirect3DVertexBuffer9	*m_pkVB;
	IDirect3DTexture9		*m_pkTexture;

	bool MakeBuffer();
	bool isInRect( int x, int y );

	UINT m_uiFVF;

	bool m_bEnable;
	bool m_bLButton;
	int m_iLeft;
	int m_iRight;
	int m_iTop;
	int m_iBottom;
	int m_iID;

	bool m_bChange;

};





#endif // _Button_H_